package com.cykj.user.service.impl;

import com.cykj.common.dto.ResponseDTO;
import com.cykj.common.entity.OrdersDO;
import com.cykj.user.mapper.OrderMapper;
import com.cykj.user.service.IOrderService;
import com.cykj.user.vo.OrdersVO;
import com.cykj.user.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.user.service.impl
 * @Author: 浮行
 * @CreateTime: 2025-08-23 10:53
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class OrderServiceImpl implements IOrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public ResponseDTO updateUserVIP(UserVO userVO) {
        Integer res = orderMapper.updateUserVIP(userVO);
        if(res > 0){
            return ResponseDTO.success();
        }
        return ResponseDTO.error();
    }

    @Override
    public ResponseDTO addOrder(OrdersVO ordersVO) {
        Integer res = orderMapper.addOrder(ordersVO);
        if(res > 0){
            return ResponseDTO.success();
        }
        return ResponseDTO.error();
    }

    @Override
    public ResponseDTO selectUserOrders(OrdersVO ordersVO) {
        List<OrdersDO> ordersDOS = orderMapper.selectUserOrders(ordersVO);
        if(ordersDOS != null){
            return ResponseDTO.success(ordersDOS);
        }
        return ResponseDTO.error();
    }
}
